package top.littlejiang.onlinexam.service;

import top.littlejiang.onlinexam.common.base.BaseService;
import top.littlejiang.onlinexam.entity.OlexamStuAnswer;
import top.littlejiang.onlinexam.entity.OlexamStuScore;
import top.littlejiang.onlinexam.vo.AutoCheckVO;
import top.littlejiang.onlinexam.vo.CheckVO;
import top.littlejiang.onlinexam.vo.SubmitPaperVO;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 学生答卷 服务类
 * </p>
 *
 * @author chen
 * @since 2021-03-11
 */
public interface OlexamStuAnswerService extends BaseService<OlexamStuAnswer> {

    /**
     * 学生提交试卷
     *
     * @param vo
     * @throws InstantiationException
     * @throws IllegalAccessException
     */
    void submitPaper(SubmitPaperVO vo) throws InstantiationException, IllegalAccessException;

    /**
     * 保存学生作答
     * @param stuAnswers
     */
    void savePaper(List<OlexamStuAnswer> stuAnswers);

    /**
     * 获取学生答卷 -> 自动阅卷
     * @param userId
     * @param examUuid
     * @return
     */
    List<AutoCheckVO> selectForAuto(Integer userId, String examUuid);

    /**
     * 查询成绩
     * @param examUuid
     * @param userId
     * @return
     */
    OlexamStuScore queryScore(String examUuid, Integer userId);

    /**
     * 计算总得分
     * @param stuScore
     * @param examUuid
     * @param userId
     * @return
     */
    OlexamStuScore computeScore(OlexamStuScore stuScore, String examUuid, Integer userId);

    /**
     * 查询一条待批阅数据
     * @param examUuid
     * @return
     */
    CheckVO queryToCheck(String examUuid);

    /**
     * 提交一条批阅数据
     * @param stuAnswer
     */
    void submitCheck(OlexamStuAnswer stuAnswer);

    /**
     * 学生成绩按类型统计
     * @param examUuid
     * @return
     */
    Map<String, Object> addUp(String examUuid);
}
